package shayu.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;


@Configurable
public class MyRedissonConfig {

    /**
     *  对所有Redisson的使用都是通过RedissonClient 对象
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redissonClient(){
        Config config = new Config();
        // 1.设置redis地址
        config.useSingleServer().setAddress("redis://175.178.168.213:6300").setPassword("guozili");

        // 2.根据config创建出RedisssonClient示例
        RedissonClient redissonClient = Redisson.create(config);

        return redissonClient;
    }

}
